const bcrypt = require('bcryptjs');
module.exports = {
    encrypt(password) {
        const salt = bcrypt.genSaltSync(10);	//加盐
        const hash = bcrypt.hashSync(password, salt);	//哈希（同步调用）
        return hash;
    },
    compare(password, hash) {
        return bcrypt.compareSync(password, hash);	//比对
    }
};